<?php
/**
 * Created by Alan.
 * User: Alan
 * Date: 2018\10\7 0007
 * Time: 6:13
 */

namespace app\common\validate;


use think\Request;
use think\Validate;

class BaseValidate extends Validate
{
    public function goCheck($scene = '')
    {
        $request = Request::instance();
        $params = $request->param();
        $result = $this->scene($scene)->check($params);
        if(!$result){
            return $this->error;
//            throw new ParameterException([
//                'msg' => $this->error
//            ]);
        }
        else
        {
            return true;
        }

    }

    public function IDMustBePositive($value, $rule, $data)
    {
        if(is_numeric($value + 0) && is_int($value + 0) && ($value + 0) > 0){
            return true;
        }
    }
}